--[[=========================================================
	TEST CLASSES
=========================================================]]--

--[[-----------------------------------------------------]]--
--	Weapon & Firemodes
--[[-----------------------------------------------------]]--
function GM:GiveTestWeapon( ply )

	--	Crete a weapon
	local weapon				= ObjWeapon(
		1,
		"weapon_sigma_m4a1",
		"TestWeapon",
		"Test Weapon",
		false,
		false,
		false,
		false,
		false
	)
	
	--	First firemode
	local firemode1				= ObjFiremode(
		0,
		"Semi",
		"Semi",
		Color( 255, 255, 255, 255 ),
		false,
		"smg1",
		30,
		30,
		3,
		30,
		1,
		ObjDamageInfo(),
		ObjDamageInfo(),
		0,
		1,
		0.2,
		0.1,
		0.1,
		0.1,
		"",
		1,
		0.3,
		1,
		0.1,
		1,
		1,
		0.07,
		3,
		0.1,
		0,
		3,
		0.3,
		0.5,
		0.3,
		0.5,
		0.5,
		0.5,
		0.3,
		0.5,
		0.5,
		0.5,
		0.6,
		ObjSoundInfo(),
		ObjSoundInfo(),
		ObjSoundInfo( 0, "ShootSoundM4", "Shoot Sound M4", "weapons/m4a1/m4a1_unsil-1.wav", false, 1, 0 ),
		ObjSoundInfo( 0, "EmptySoundM4", "Empty Sound M4", "Weapon_Pistol.Empty", false, 1, 0 ),
		ObjSoundInfo(),
		ObjSoundInfo(),
		ObjSoundInfo(),
		ObjSoundInfo(),
		ObjSoundInfo(),
		ObjSoundInfo(),
		ObjSoundInfo(),
		ObjSoundInfo(),
		ObjSoundInfo(),
		ObjSoundInfo(),
		ObjSoundInfo(),
		ObjSoundInfo(),
		ObjSoundInfo(),
		ObjSoundInfo( 0, "MeleeSoundM4", "Melee Sound M4", "NPC_Antlion.MeleeAttack", false, 0.5, 0 ),
		ObjActivityInfo( 0, "IdleActM4", "Idle Act M4", ACT_VM_IDLE, 0.5, 0 ),
		ObjActivityInfo( 0, "DeployActM4", "Deploy Act M4", ACT_VM_DRAW, 0.5, 0 ),
		ObjActivityInfo( 0, "ShootActM4", "Shoot Act M4", ACT_VM_PRIMARYATTACK, 0.5, 0 ),
		ObjActivityInfo( 0, "ReloadActM4", "Reload Act M4", ACT_VM_RELOAD, 0.5, 0 ),
		ObjActivityInfo(),
		ObjActivityInfo(),
		ObjActivityInfo(),
		ObjActivityInfo(),
		ObjActivityInfo(),
		ObjActivityInfo(),
		ObjActivityInfo(),
		ObjActivityInfo(),
		ObjActivityInfo(),
		ObjActivityInfo(),
		ObjActivityInfo(),
		"",
		"",
		"",
		ObjViewTransformInfo( 0, Vector( 6.25, 7.5, 0.5 ), Angle( 3, 1.5, 3 ), 55, 0 ),
		ObjViewTransformInfo( 0, Vector( 0, 0, 0 ), Angle( 0, 0, 0 ), 90, 0 ),
		ObjViewTransformInfo( 0, Vector( 0, -10, 0 ), Angle( 0, -80, 0 ), 95, 0 ),
		ObjViewTransformInfo( 0, Vector( 0, 0, 0 ), Angle( 0, 0, 0 ), 95, 0 ),
		ObjViewTransformInfo( 0, Vector( 0, -15, -10 ), Angle( 80, 0, 0 ), 90, 75 ),
		ObjViewTransformInfo( 0, Vector( 0, 0, 0 ), Angle( 0, 0, 0 ), 90, 50 ),
		ObjViewTransformInfo( 0, Vector( 0, 0, 0 ), Angle( 0, 0, 0 ), 90, 100 ),
		ObjViewTransformInfo( 0, Vector( 0, 0, 0 ), Angle( 0, 0, 0 ), 55, 0 )
	)
	
	--	Second firemode
	local firemode2				= ObjFiremode(
		0,
		"Auto",
		"Auto",
		Color( 255, 255, 255, 255 ),
		true,
		"smg1",
		30,
		30,
		1,
		30,
		1,
		ObjDamageInfo(),
		ObjDamageInfo(),
		0,
		1,
		0.2,
		0.1,
		0.1,
		0.1,
		"",
		1,
		0.3,
		1,
		0.1,
		1,
		1,
		0.07,
		3,
		0.1,
		0,
		3,
		0.3,
		0.5,
		0.3,
		0.5,
		0.5,
		0.5,
		0.3,
		0.5,
		0.5,
		0.5,
		0.6,
		ObjSoundInfo(),
		ObjSoundInfo(),
		ObjSoundInfo( 0, "ShootSoundM4", "Shoot Sound M4", "weapons/m4a1/m4a1_unsil-1.wav", false, 1, 0 ),
		ObjSoundInfo( 0, "EmptySoundM4", "Empty Sound M4", "Weapon_Pistol.Empty", false, 1, 0 ),
		ObjSoundInfo(),
		ObjSoundInfo(),
		ObjSoundInfo(),
		ObjSoundInfo(),
		ObjSoundInfo(),
		ObjSoundInfo(),
		ObjSoundInfo(),
		ObjSoundInfo(),
		ObjSoundInfo(),
		ObjSoundInfo(),
		ObjSoundInfo(),
		ObjSoundInfo(),
		ObjSoundInfo(),
		ObjSoundInfo( 0, "MeleeSoundM4", "Melee Sound M4", "NPC_Antlion.MeleeAttack", false, 0.5, 0 ),
		ObjActivityInfo( 0, "IdleActM4", "Idle Act M4", ACT_VM_IDLE, 0.5, 0 ),
		ObjActivityInfo( 0, "DeployActM4", "Deploy Act M4", ACT_VM_DRAW, 0.5, 0 ),
		ObjActivityInfo( 0, "ShootActM4", "Shoot Act M4", ACT_VM_PRIMARYATTACK, 0.5, 0 ),
		ObjActivityInfo( 0, "ReloadActM4", "Reload Act M4", ACT_VM_RELOAD, 0.5, 0 ),
		ObjActivityInfo(),
		ObjActivityInfo(),
		ObjActivityInfo(),
		ObjActivityInfo(),
		ObjActivityInfo(),
		ObjActivityInfo(),
		ObjActivityInfo(),
		ObjActivityInfo(),
		ObjActivityInfo(),
		ObjActivityInfo(),
		ObjActivityInfo(),
		"",
		"",
		"",
		ObjViewTransformInfo( 0, Vector( 5.89, -3.77, 1.07 ), Vector( 3.49, 1.3, 3 ):Angle(), 55, 0 ),
		ObjViewTransformInfo( 0, Vector( 2.56, -4.68, 1.07 ), Vector( -21.37, -10.15, 3 ):Angle(), 90, 0 ),
		ObjViewTransformInfo( 0, Vector( 5.89, -3.77, 1.07 ), Vector( 3.49, 1.3, 3 ):Angle(), 95, 0 ),
		ObjViewTransformInfo( 0, Vector( 5.89, -3.77, 1.07 ), Vector( 3.49, 1.3, 3 ):Angle(), 95, 0 ),
		ObjViewTransformInfo( 0, Vector( 5.89, -3.77, 1.07 ), Vector( 3.49, 1.3, 3 ):Angle(), 90, 75 ),
		ObjViewTransformInfo( 0, Vector( 5.89, -3.77, 1.07 ), Vector( 3.49, 1.3, 3 ):Angle(), 90, 50 ),
		ObjViewTransformInfo( 0, Vector( 5.89, -3.77, 1.07 ), Vector( 3.49, 1.3, 3 ):Angle(), 90, 100 ),
		ObjViewTransformInfo( 0, Vector( 5.89, -3.77, 1.07 ), Vector( 3.49, 1.3, 3 ):Angle(), 55, 0 )
	)
	
	--	Weapon firemode 1
	local link1					= ObjWeaponFiremode(
		weapon,
		firemode1,
		true,
		"smg",
		true,
		true,
		true,
		true,
		true,
		false,
		false,
		true,
		false
	)
	
	--	Weapon firemode 2
	local link2					= ObjWeaponFiremode(
		weapon,
		firemode2,
		true,
		"smg",
		true,
		true,
		true,
		true,
		true,
		false,
		false,
		true,
		false
	)
	
	--	Create & give weapon to player
	ply:Give( weapon.Base )
	ply:GetWeapon( weapon.Base ):Setup( weapon, link1, link2 )

end

function GM:RcvTestNetMsg( len )

	DEBUG:Msg( "Receiving test msg..." )
	
	local wpn					= net.ReadTable()
	local lnk1					= net.ReadTable()
	local lnk2					= net.ReadTable()
	local tst1					= net.ReadTable()
	local tst2					= net.ReadTable()
	local tst3					= net.ReadTable()
	local tst4					= net.ReadTable()
	PrintTable( wpn )
	PrintTable( lnk1 )
	PrintTable( lnk2 )
	print( tostring( tst1 ) )
	print( tostring( tst2 ) )
	print( tostring( tst3 ) )
	print( tostring( tst4 ) )
	print( tostring( table.Count( tst1 ) ) )
	print( tostring( table.Count( tst2 ) ) )
	--	It keeps creating new tables but they are empty !!!

end

function GM:TestNetMsg()

	if SERVER then
	
		--	Crete a weapon
		local weapon				= ObjWeapon(
			1,
			"weapon_sigma_m4a1",
			"TestWeapon",
			"Test Weapon",
			false,
			false,
			false,
			false,
			false
		)
		
		--	First firemode
		local firemode1				= ObjFiremode(
			0,
			"Semi",
			"Semi",
			Color( 255, 255, 255, 255 ),
			false,
			"smg1",
			30,
			30,
			3,
			30,
			1,
			ObjDamageInfo(),
			ObjDamageInfo(),
			0,
			1,
			0.2,
			0.1,
			0.1,
			0.1,
			"",
			1,
			0.3,
			1,
			0.1,
			1,
			1,
			0.07,
			3,
			0.1,
			0,
			3,
			0.3,
			0.5,
			0.3,
			0.5,
			0.5,
			0.5,
			0.3,
			0.5,
			0.5,
			0.5,
			0.6,
			ObjSoundInfo(),
			ObjSoundInfo(),
			ObjSoundInfo( 0, "ShootSoundM4", "Shoot Sound M4", "weapons/m4a1/m4a1_unsil-1.wav", false, 1, 0 ),
			ObjSoundInfo( 0, "EmptySoundM4", "Empty Sound M4", "Weapon_Pistol.Empty", false, 1, 0 ),
			ObjSoundInfo(),
			ObjSoundInfo(),
			ObjSoundInfo(),
			ObjSoundInfo(),
			ObjSoundInfo(),
			ObjSoundInfo(),
			ObjSoundInfo(),
			ObjSoundInfo(),
			ObjSoundInfo(),
			ObjSoundInfo(),
			ObjSoundInfo(),
			ObjSoundInfo(),
			ObjSoundInfo(),
			ObjSoundInfo( 0, "MeleeSoundM4", "Melee Sound M4", "NPC_Antlion.MeleeAttack", false, 0.5, 0 ),
			ObjActivityInfo( 0, "IdleActM4", "Idle Act M4", ACT_VM_IDLE, 0.5, 0 ),
			ObjActivityInfo( 0, "DeployActM4", "Deploy Act M4", ACT_VM_DRAW, 0.5, 0 ),
			ObjActivityInfo( 0, "ShootActM4", "Shoot Act M4", ACT_VM_PRIMARYATTACK, 0.5, 0 ),
			ObjActivityInfo( 0, "ReloadActM4", "Reload Act M4", ACT_VM_RELOAD, 0.5, 0 ),
			ObjActivityInfo(),
			ObjActivityInfo(),
			ObjActivityInfo(),
			ObjActivityInfo(),
			ObjActivityInfo(),
			ObjActivityInfo(),
			ObjActivityInfo(),
			ObjActivityInfo(),
			ObjActivityInfo(),
			ObjActivityInfo(),
			ObjActivityInfo(),
			"",
			"",
			"",
			ObjViewTransformInfo( 0, Vector( 5.89, -3.77, 1.07 ), Vector( 3.49, 1.3, 3 ), 55, 0 ),
			ObjViewTransformInfo( 0, Vector( 2.56, -4.68, 1.07 ), Vector( -21.37, -10.15, 3 ), 90, 0 ),
			ObjViewTransformInfo( 0, Vector( 5.89, -3.77, 1.07 ), Vector( 3.49, 1.3, 3 ), 95, 0 ),
			ObjViewTransformInfo( 0, Vector( 5.89, -3.77, 1.07 ), Vector( 3.49, 1.3, 3 ), 95, 0 ),
			ObjViewTransformInfo( 0, Vector( 5.89, -3.77, 1.07 ), Vector( 3.49, 1.3, 3 ), 90, 75 ),
			ObjViewTransformInfo( 0, Vector( 5.89, -3.77, 1.07 ), Vector( 3.49, 1.3, 3 ), 90, 50 ),
			ObjViewTransformInfo( 0, Vector( 5.89, -3.77, 1.07 ), Vector( 3.49, 1.3, 3 ), 90, 100 ),
			ObjViewTransformInfo( 0, Vector( 5.89, -3.77, 1.07 ), Vector( 3.49, 1.3, 3 ), 55, 0 )
		)
		
		--	Second firemode
		local firemode2				= ObjFiremode(
			0,
			"Auto",
			"Auto",
			Color( 255, 255, 255, 255 ),
			true,
			"smg1",
			30,
			30,
			1,
			30,
			1,
			ObjDamageInfo(),
			ObjDamageInfo(),
			0,
			1,
			0.2,
			0.1,
			0.1,
			0.1,
			"",
			1,
			0.3,
			1,
			0.1,
			1,
			1,
			0.07,
			3,
			0.1,
			0,
			3,
			0.3,
			0.5,
			0.3,
			0.5,
			0.5,
			0.5,
			0.3,
			0.5,
			0.5,
			0.5,
			0.6,
			ObjSoundInfo(),
			ObjSoundInfo(),
			ObjSoundInfo( 0, "ShootSoundM4", "Shoot Sound M4", "weapons/m4a1/m4a1_unsil-1.wav", false, 1, 0 ),
			ObjSoundInfo( 0, "EmptySoundM4", "Empty Sound M4", "Weapon_Pistol.Empty", false, 1, 0 ),
			ObjSoundInfo(),
			ObjSoundInfo(),
			ObjSoundInfo(),
			ObjSoundInfo(),
			ObjSoundInfo(),
			ObjSoundInfo(),
			ObjSoundInfo(),
			ObjSoundInfo(),
			ObjSoundInfo(),
			ObjSoundInfo(),
			ObjSoundInfo(),
			ObjSoundInfo(),
			ObjSoundInfo(),
			ObjSoundInfo( 0, "MeleeSoundM4", "Melee Sound M4", "NPC_Antlion.MeleeAttack", false, 0.5, 0 ),
			ObjActivityInfo( 0, "IdleActM4", "Idle Act M4", ACT_VM_IDLE, 0.5, 0 ),
			ObjActivityInfo( 0, "DeployActM4", "Deploy Act M4", ACT_VM_DRAW, 0.5, 0 ),
			ObjActivityInfo( 0, "ShootActM4", "Shoot Act M4", ACT_VM_PRIMARYATTACK, 0.5, 0 ),
			ObjActivityInfo( 0, "ReloadActM4", "Reload Act M4", ACT_VM_RELOAD, 0.5, 0 ),
			ObjActivityInfo(),
			ObjActivityInfo(),
			ObjActivityInfo(),
			ObjActivityInfo(),
			ObjActivityInfo(),
			ObjActivityInfo(),
			ObjActivityInfo(),
			ObjActivityInfo(),
			ObjActivityInfo(),
			ObjActivityInfo(),
			ObjActivityInfo(),
			"",
			"",
			"",
			ObjViewTransformInfo( 0, Vector( 5.89, -3.77, 1.07 ), Vector( 3.49, 1.3, 3 ), 55, 0 ),
			ObjViewTransformInfo( 0, Vector( 2.56, -4.68, 1.07 ), Vector( -21.37, -10.15, 3 ), 90, 0 ),
			ObjViewTransformInfo( 0, Vector( 5.89, -3.77, 1.07 ), Vector( 3.49, 1.3, 3 ), 95, 0 ),
			ObjViewTransformInfo( 0, Vector( 5.89, -3.77, 1.07 ), Vector( 3.49, 1.3, 3 ), 95, 0 ),
			ObjViewTransformInfo( 0, Vector( 5.89, -3.77, 1.07 ), Vector( 3.49, 1.3, 3 ), 90, 75 ),
			ObjViewTransformInfo( 0, Vector( 5.89, -3.77, 1.07 ), Vector( 3.49, 1.3, 3 ), 90, 50 ),
			ObjViewTransformInfo( 0, Vector( 5.89, -3.77, 1.07 ), Vector( 3.49, 1.3, 3 ), 90, 100 ),
			ObjViewTransformInfo( 0, Vector( 5.89, -3.77, 1.07 ), Vector( 3.49, 1.3, 3 ), 55, 0 )
		)
		
		--	Weapon firemode 1
		local link1					= ObjWeaponFiremode(
			weapon,
			firemode1,
			true,
			"smg",
			true,
			true,
			true,
			true,
			true,
			false,
			false,
			true,
			false
		)
		
		--	Weapon firemode 2
		local link2					= ObjWeaponFiremode(
			weapon,
			firemode2,
			true,
			"smg",
			true,
			true,
			true,
			true,
			true,
			false,
			false,
			true,
			false
		)
		
		DEBUG:Msg( "Sending test msg..." )
	
		net.Start( "TestNetMsg" )
		net.WriteTable( weapon:GetClientTable() )
		net.WriteTable( link1:GetClientTable() )
		net.WriteTable( link2:GetClientTable() )
		net.Send( player.GetByID( 1 ) )
		
	end

end